package com.leyou.item.mapper;

import com.leyou.common.mapper.BaseMapper;
import com.leyou.item.entity.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;



import java.util.List;

public interface BrandMapper extends BaseMapper<Brand> {
    Integer insertCategoryBrand(@Param("brandId") Long brandId,@Param("categoryIds") List<Long> categoryIds);

    //删除与该品牌相关联的种类
    @Select("DELETE FROM tb_category_brand where brand_id=#{brandId}")
    Integer deleteCategoryByBrandId(@Param("brandId") Long brandId);

    @Select("select tb.* from tb_category_brand tcb INNER JOIN tb_brand tb on tcb.brand_id=tb.id AND tcb.category_id=#{categoryId}")
    List<Brand> queryBrandsByCategoryId(@Param("categoryId")Long categoryId);


}